package com.sright.bcard.content.dal.dao.impl;

import com.sright.bcard.common.service.share.base.dao.BaseDAOImpl;
import com.sright.bcard.common.service.share.base.dao.BaseMapper;
import com.sright.bcard.content.dal.dao.CardDAO;
import com.sright.bcard.content.dal.entity.CardDO;
import com.sright.bcard.content.dal.mapper.CardDOMapper;
import com.sright.bcard.content.dal.query.CardListParamQuery;
import com.sright.bcard.content.dal.result.CardListDTO;
import com.sright.bcard.content.dal.result.CardListResult;
import com.sright.bcard.content.dal.result.EnterpriseCardResult;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class CardDAOImpl extends BaseDAOImpl<CardDO> implements CardDAO {

    @Resource
    private CardDOMapper cardDOMapper;

    @Override
    protected BaseMapper<CardDO> getObjMapper() {
        return cardDOMapper;
    }

    @Override
    public Integer deleteById(Long id) {
        return cardDOMapper.deleteById(id);
    }

    @Override
    public List<CardListResult> cardList(CardListParamQuery cardListParamQuery) {
        return cardDOMapper.cardList(cardListParamQuery);
    }

    @Override
    public Integer count(CardListParamQuery cardListParamQuery) {
        return cardDOMapper.count(cardListParamQuery);
    }

    @Override
    public CardDO selectByUserId(Long personalUserId) {
        return cardDOMapper.selectByUserId(personalUserId);
    }

    @Override
    public List<CardListDTO> selectIdListByUserId(Long userId) {
        return cardDOMapper.selectIdListByUserId(userId);
    }

    @Override
    public List<CardListDTO> selectIdListByEnterpriseId(Long enterpriseId) {
        return cardDOMapper.selectIdListByEnterpriseId(enterpriseId);
    }

    @Override
    public Integer enterpriseCardCount(String title, Long enterpriseId) {
        return cardDOMapper.enterpriseCardCount(title, enterpriseId);
    }

    @Override
    public List<EnterpriseCardResult> queryEnterpriseCard(String title, Integer offset, Integer limit, Long enterpriseId) {
        return cardDOMapper.queryEnterpriseCard(title, offset, limit, enterpriseId);
    }

    @Override
    public List<CardDO> selectByCardBaseInfoIds(List<Long> cardBaseInfoIds) {
        return cardDOMapper.selectByCardBaseInfoIds(cardBaseInfoIds);
    }
}
